import sys
from PyQt5.QtWidgets import (QMainWindow, QTextEdit,
    QAction, QFileDialog, QApplication)
from PyQt5.QtGui import QIcon


class myui(QMainWindow):
    def __init__(self):
        super(myui, self).__init__()
        self.initUI()

    def initUI(self):
        openFile=QAction('open',self)
        openFile.setShortcut('Ctrl+O')
        openFile.setStatusTip("open a 'txt' file")
        openFile.triggered.connect(self.showDialog)

        menubar=self.menuBar()
        fileMenu=menubar.addMenu('File')
        fileMenu.addAction(openFile)

        self.setGeometry(300,300,350,300)
        self.setWindowTitle('MainWindow')
        self.show()

    def showDialog(self):
        fname=QFileDialog.getOpenFileName(self,'Txt File input','/home')
        if fname[0]:
            f=open(fname[0],'r')
        self.statusBar().showMessage('file have benn loaded')


if __name__=='__main__':
    app = QApplication(sys.argv)
    test=myui()
    sys.exit(app.exec_())